package mr

import (
	"errors"
	"fmt"
	"io"
	"os"
)

// 适配读取不同大小的文件

func Read2Bytes(file *os.File) ([]byte, error) {
	con, err := io.ReadAll(file)
	if err != nil {
		info := fmt.Sprintf("Read2Bytes Error:%v", err.Error())
		return nil, errors.New(info)
	}
	return con, nil
}

func Read2String(file *os.File) (string, error) {
	con, err := io.ReadAll(file)
	if err != nil {
		info := fmt.Sprintf("Read2String Error:%v", err.Error())
		return "", errors.New(info)
	}
	return string(con), nil
}
